﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace WindowsGame1
{
	public class UIButton : UIObject
	{
		public UIButtonState ButtonState;
		private int _frame = 0;
		private Vector2 _position;
		
		public UIButton(string texture, Vector2 positon, UIObject parent) : base(texture,positon,parent)
		{
			ButtonState = UIButtonState.None;			
		}
		public void Update(Vector2 mouse, int left)
		{
			bool checker = false;

            if (left > 0)
            {
                _frame = 1;
            }
			if (BoundingBox.Contains((int)mouse.X, (int)mouse.Y))
			{
                if (_frame == 1 && left == 0)
                {
                    _frame = 0;
                    TVSGame.ExitGame();
                }
				checker = true;
			}
			else
			{
				checker = false;
                if (left == 0)
                {
                    _frame = 0;
                }
			}
			Console.WriteLine(checker);
		}
		
	}
}
